const mongoose = require('../../../dao/mongo/mongo');

const Schema = mongoose.Schema;
const userSchema = new Schema({
    uid: {type: String, required: true, tags: {type: [String], index: true}},    //用户ID
    real_open_id: {type: String, tags: {type: [String], index: true}}, //用户的真实openid
    invite_id: {type: String, default: ''},//邀请码 客户端用户显示ID
    title: {type: String, default: '普通用户'},   //矿工名称
    title_logo: {type: String, default: ''},    //矿工头像
    parent_id: {type: String, default: '', tags: {type: [String], index: true}},   //父用户ID
    union_id: {type: String, default: '', tags: {type: [String], index: true}},    //用户微信联盟ID
    nickname: {type: String},   //昵称
    avatar: {type: String, default: ''},    //头像
    gender: {type: Number, default: 1},   //性别，1是男性，0是女性
    city: {type: String, default: ''},    //城市
    province: {type: String, default: ''},    //省份
    phone: {type: String, default: "", tags: {type: [String], index: true}}, // 用户手机号
    contact_info: {type: String, default: ""}, // 用户用于显示的联系信息
    ip: {type: String, default: ""},    //用户IP
    video_num: {type: Number, default: 0}, // 看视频次数
    total_video: {type: Number, default: 0}, //看视频总次数
    is_effect_user: {type: Boolean, default: false}, //是否有效用户
    last_login_time: {type: Number, default: 0}, //上次登陆时间
    last_logout_time: {type: Number, default: 0}, //上次退出时间
    apprentice_num: {type: Number, default: 0},   // 当前徒弟数
    disciple_num: {type: Number, default: 0},   // 当前徒孙数
    apprentice_oil: {type: Number, default: 0}, //徒弟贡献石油
    disciple_oil: {type: Number, default: 0}, //徒孙贡献石油
    apprentice_oil_today: {type: Number, default: 0}, //徒弟今日贡献石油
    disciple_oil_today: {type: Number, default: 0}, //徒孙今日贡献石油
    new_player_prize: {type: Number, default: 0},//是否领取过新手奖励
    total_oil: {type: Number, default: 0},//总石油数
    depth_level: {type: Number, default: 0}, //深度等级
    share_poster: {type: String, default: ''},//海报图
    first_withdraw: {type: Boolean, default: false}, //是否提取过激励奖金
    welfare_oil: {type: Number, default: 0}, //福利时刻累积石油
    welfare: {type: Array, default: []},
    coins: {type: String, default: '0'}, //用户的金币
    doubleTime: {type: Boolean, default: false}, //是否在双倍奖励时间
    gmt_create: {type: Number}, //用户创建时间
    gmt_modified: {type: Number}, //用户更新时间
    current_level: {type: Number, default: 0} //当前矿层层数
});

module.exports = mongoose.model('user', userSchema);
